package com.example.feign;

import com.example.pojo.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "permission-service",path = "permission")
public interface PermissionFeignClient {
    @PostMapping("/bindDefaultRole")
    Result bindDefaultRole(@RequestParam("userId") Long userId);

    // 查询用户角色码（返回role_code）
    @PostMapping("/getUserRoleCode")
    String getUserRoleCode(@RequestParam("userId") Long userId);

    // 超管调用：升级用户为管理员
    @PostMapping("/upgradeToAdmin")
    void upgradeToAdmin(Long userId);

    // 超管调用：降级用户为普通角色
    @PostMapping("/downgradeToUser")
    void downgradeToUser(Long userId);
}
